package commons.log;

import java.util.ArrayList;
import java.util.List;

/**
 * 日志包装类
 */
public final class LogWrapper implements RtLog
{
	private static final List<RtLog> LOGS=new ArrayList<>();

	private LogWrapper()
	{
	}

	static
	{
		addLog(new Logcat());
	}

	public static void addLog(RtLog log)
	{
		LOGS.add(log);
	}

	@Override
	public void debug(String tag,String msg)
	{
		for(RtLog log : LOGS)
		{
			if(log!=null)
			{
				log.debug(tag,msg);
			}
		}
	}

	@Override
	public void info(String tag,String msg)
	{
		for(RtLog log : LOGS)
		{
			if(log!=null)
			{
				log.info(tag,msg);
			}
		}
	}

	@Override
	public void err(String tag,String msg)
	{
		for(RtLog log : LOGS)
		{
			if(log!=null)
			{
				log.err(tag,msg);
			}
		}
	}
}